package pa3;

class Money {
    public double money = 99.99;
}

class Person implements Cloneable{
    public Money m = new Money();

    @Override
    protected Object clone() throws CloneNotSupportedException {

        Person tmp = (Person) super.clone();

        return tmp;
    }
}

public class Test{
    public static void main(String[] args) throws CloneNotSupportedException {
        Person person1 = new Person();
        Person person2 = (Person) person1.clone();
        System.out.println("通过person2修改前的结果");
        System.out.println(person1.m.money);
        System.out.println(person2.m.money);

        person2.m.money = 13.6;
        System.out.println("通过person2修改后的结果");
        System.out.println(person1.m.money);
        System.out.println(person2.m.money);
    }
}


